<?php
header('Content-Type: text/html; charset=UTF-8');

session_start();

@$userID =  $_SESSION['userId'];

if(empty($userID)){
	die(json_encode(array('status'=>false,'info'=>'操作超时！')));
};

@$inCash = $_REQUEST['inCash'];

require 'lib/db.php';

$flag = dbUpdate('update user set money=money+:inCash where id=:id',array('inCash'=>$inCash,'id'=>$userID));

if(!$flag){
	die(json_encode(array('status'=>false,'info'=>'存款失败！')));
};

@$user = dbSelect('select money from user where id=:id',array('id'=>$userID));

echo json_encode(array('status'=>true,'money'=>$user['money']));